package Lab5;

import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Queue;

public class PriorityQueues {
    public static void main(String[] args) {
        Queue<String> q1 = new PriorityQueue<>();
        Queue<String> q2 = new PriorityQueue<>();
        q1.addAll(Arrays.asList(new String[]{"George", "Jim", "John", "Blake", "Kevin", "Michael"}));
        q2.addAll(Arrays.asList(new String[]{"George", "Katie", "Kevin", "Michelle", "Ryan"}));

        System.out.println("q1: " + q1 + ", q2: " + q2);
        q1.addAll(q2);
        System.out.println("addAll q1: " + q1);
        q1.removeAll(q2);
        System.out.println("removeAll q1: " + q1);

        q1.clear();
        q1.addAll(Arrays.asList(new String[]{"George", "Jim", "John", "Blake", "Kevin", "Michael"}));

        q1.retainAll(q2);
        System.out.println("retainAll q1: " + q1);

    }
}
